﻿package mortal.game.view.friend
{
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class DeleteCellRenderer extends GCellRenderer
    {
        private var _roleName:GTextFiled;
        private var _cancelBtn:GButton;
        private var _dataSource:Object;

        public function DeleteCellRenderer()
        {
            this.setSize(153, 25);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._roleName = UIFactory.gTextField("", 11, 2, 98, 20, this, GlobalStyle.textFormatDanLan);
            this._cancelBtn = UIFactory.gButton(Language.getString(41209), 112, 3, 41, 22, this);
            this.pushUIToDisposeVec(UIFactory.bg(0, 27, 160 + 10, 1, this, ImagesConst.SplitLine));
            this._cancelBtn.configEventListener(MouseEvent.CLICK, this.onClickHandler);
            return;
        }// end function

        override protected function initSkin() : void
        {
            var _loc_1:* = new GBitmap();
            var _loc_2:* = UIFactory.bg(0, 0, 0, 0, null, ImagesConst.SelectBg);
            this.setStyle("downSkin", _loc_2);
            this.setStyle("overSkin", _loc_2);
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", _loc_2);
            this.setStyle("selectedOverSkin", _loc_2);
            this.setStyle("selectedUpSkin", _loc_2);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:* = param1.data as SelectedCellRenderer;
            this._dataSource = param1;
            this._roleName.text = _loc_2.roleName;
            return;
        }// end function

        private function onClickHandler(event:MouseEvent) : void
        {
            if (this.dataSource != null)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.FriendCancelDelete, this.dataSource));
            }
            return;
        }// end function

        public function get dataSource() : Object
        {
            return this._dataSource;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.selected = false;
            super.disposeImpl(param1);
            this._roleName.dispose(param1);
            this._cancelBtn.dispose(param1);
            this._roleName = null;
            this._cancelBtn = null;
            return;
        }// end function

    }
}
